package org.dandsoft.blackbox.evolution.triggers;

import org.dandsoft.blackbox.Signal;
import org.dandsoft.blackbox.SignalId;

import java.util.Map;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class WeightTrigger extends AbstractTrigger {

    private int result;

    public void putSignal(Signal signal) {
        Map<SignalId, Integer> data = getNet().getSignalsData(super.getSignalId());
        Integer weight = data.get(signal.getSignalId());
        this.result += signal.getValue() * weight;
    }

    public void putHintSignal(Signal signal) {

    }

    public Signal getState() {
        return new Signal(super.getSignalId(), result);
    }

    public boolean isChangedState() {
        return true;
    }
}
